/***
* Feel free to use this code however you wish.
* Created by Alie Tan (www(dot)alietan(dot)com)
*/

#ifndef __POLYTOOL_H__
#define __POLYTOOL_H__

#include <MoBox2D/Box2D.h>


class PolyTool
{
public:
	static float lengthOfLine(b2Vec2 p1, b2Vec2 p2);
	static bool isPolyConvex(b2Vec2* vertices, int32 vertexCount);
	static bool isPolyClockwise(b2Vec2* vertices, int32 vertexCount);
	static bool insideTriangle(float Ax, float Ay, float Bx, float By, float Cx, float Cy, float Px, float Py);

	static float area(const b2Vec2 *vertices, int vertexCount);
	static bool snip(const b2Vec2 *vertices,int u,int v,int w,int n,int *V);
	static int getTriangulatedPoly(const b2Vec2 *vertices, b2Vec2 *result, int vertexCount);
	static float isLeft( b2Vec2 p0, b2Vec2 p1, b2Vec2 p2 );
	static int	getConvexPoly( const b2Vec2* vertices, b2Vec2 *result, int n );

};

#endif	// __POLYTOOL_H__
